/**
 * 工具类
 */
define(function (require, exports, module) {
    var $ = require("jquery");
    var ui = require("ui");
    var staticPublicUtil = require('/static_public/js/util');

    var Util = {
        /**
         * 获取项目列表
         * @returns {undefined}
         */
        getProjList: function (callback, context) {
            var url = G_CONFIG["api_prefix"] + "/qmyx/customer-manage/get-project-list";
            this.myAjax({
                url: url,
                type: "get",
                context: this,
                success: function (json) {
                    if (json.retCode == 0) {
                        callback.call(context, json.data);
                    } else {
                        ui.showErrTip(json.errMsg || json.retMsg);
                    }
                }
            });
        },
        /**
         * 根据参数code获取参数值列表
         * @param {type} param_code 参数code
         * @param {type} scope_id token或proj_id
         * @param {type} callback 回调
         * @param {type} context 上下文对象
         * @returns {undefined}
         */
        getParamValuesByCode: function (param_code, scope_id, callback, context) {
            var url = G_CONFIG["api_prefix"] + "/qmyx/para-setting/get-param-values-by-code";
            var data = {
                scope_id: scope_id,
                param_code: param_code
            };
            this.myAjax({
                url: url,
                type: "get",
                context: this,
                data: data,
                success: function (json) {
                    if (json.retCode == 0) {
                        callback.call(context, json.data);
                    } else {
                        ui.showErrTip(json.errMsg);
                    }
                }
            });
        }
    };

    for (var key in staticPublicUtil) {
        if (staticPublicUtil.hasOwnProperty(key)) {
            Util[key] = staticPublicUtil[key];
        }
    }

    return Util;
});